#!/bin/bash

set -e
if [ -L $0 ]; then
    BASE_DIR=`dirname $(readlink $0)`
else
    BASE_DIR=`dirname $0`
fi
bashpath=$(cd $BASE_DIR; pwd)
cd $bashpath

rm -rf "$bashpath/static"
rm -f "$bashpath/ipset-manager"
rm -f "$bashpath/ipset-manager.exe"

cd "$bashpath/web"
PUBLIC_URL="__ipset_manager_web_basename_placeholder__/web" npm run build

cp -a "$bashpath/web/build" "$bashpath/static"
cd $bashpath




GOOS=linux go build -x
